# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=intrace
pkgver=1.6
pkgrel=1
groups=('blackarch' 'blackarch-recon')
pkgdesc='Traceroute-like application piggybacking on existing TCP connections.'
url='http://intrace.googlecode.com'
arch=('x86_64' 'aarch64')
license=('GPL-2.0-only' 'GPL-3.0-only')
source=("https://github.com/robertswiecki/intrace/archive/refs/tags/$pkgname-$pkgver.tar.gz"
        'Makefile.patch')
sha512sums=('3d2576135dfb8eb9084ccdd810b6325dc434e78ed8b7e9356905cb4a72aad7652c4a3a33371a4b276d24c3e4f7bdf1c4de42c36384fc4519273373cb5fa325fc'
            'd7ee3cefbc3c9571b670e198ade2aea13c4edbf6c9c6aa521d0d21546b63ac651ca0074f56937eb458882f8460ff6d46593b88d1a62a1f00d5200feb44a5dc4d')
prepare() {
  cd "$pkgname-$pkgname-$pkgver"

  patch -Np0 -i "$srcdir/Makefile.patch"
}

build() {
  cd "$pkgname-$pkgname-$pkgver"

  make
}

package() {
  cd "$pkgname-$pkgname-$pkgver"

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 755 $pkgname "$pkgdir/usr/share/$pkgname/$pkgname"
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" ChangeLog README.md

  ln -sf "/usr/share/$pkgname/$pkgname" "$pkgdir/usr/bin/$pkgname"
}

